Skip to content

Fixes #37882 - Remove @theforeman/vendor - #10342

Merged
ShimShtein merged 1 commit into
theforeman:developfrom
MariaAga:remove-foreman-vendor
Jul 14, 2025
Merged

Fixes #37882 - Remove @theforeman/vendor#10342
ShimShtein merged 1 commit into
theforeman:developfrom
MariaAga:remove-foreman-vendor

Conversation

@MariaAga

@MariaAga MariaAga commented Oct 8, 2024

Copy link
Copy Markdown
Member

Depends on #10345 #10239
"Fixes #37904 - move css from vendor to foreman " Does not bread plugins, but this pr does:
Some plugins have "peerDependencies": "@theforeman/vendor" or assume theforeman/vendor will be available from core, this PR removed theforeman/vendor so it will not be available anymore, and their webpack build will fail with:

ERROR in ./components/AnsibleRolesSwitcher/AnsibleRolesSwitcher.scss (../../foreman/node_modules/css-loader/dist/cjs.js!../../foreman/node_modules/sass-loader/dist/cjs.js!./components/AnsibleRolesSwitcher/AnsibleRolesSwitcher.scss)
webpack.1 | Module build failed (from ../../foreman/node_modules/sass-loader/dist/cjs.js):
webpack.1 | Can't find stylesheet to import.
webpack.1 |   ╷
webpack.1 | 1 │ @import '~@theforeman/vendor/scss/variables';
webpack.1 |   │         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

and will have this console error:

Uncaught (in promise) Error: Module build failed (from ../../foreman/node_modules/sass-loader/dist/cjs.js):
Can't find stylesheet to import.
  ╷
1 │ @import '~@theforeman/vendor/scss/variables';
  │         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ╵
  ../foreman_ansible/webpack/components/AnsibleRolesSwitcher/AnsibleRolesSwitcher.scss 1:9  root stylesheet

@github-actions github-actions Bot added UI Legacy JS PRs making changes in the legacy Javascript stack Docs labels Oct 8, 2024
Comment thread webpack/assets/javascripts/react_app/common/helpers.js Outdated
Comment thread app/views/layouts/base.html.erb Outdated
Comment thread package.json Outdated
@MariaAga

Copy link
Copy Markdown
Member Author

In this PR we had to update to npm 8 to get the "overrides" attribute in package.json - "Overrides provide a way to replace a package in your dependency tree with another version, or another package entirely. ".
Which we need to pin victory packages that are used in pf4 charts package. before I think because of some vendor magic pf4 used our install victory, and not the one from the pf4 node_modules, but since I'm simplifying things and moving it all to foreman it doesnt work anymore so we need to completely override victory versions, and not just installing an old one.

@theforeman/packaging are we ok to update to NPM 8+?

@MariaAga
MariaAga force-pushed the remove-foreman-vendor branch 2 times, most recently from d48bcac to 005f580 Compare October 30, 2024 16:54
@MariaAga

Copy link
Copy Markdown
Member Author

@theforeman/packaging are we ok to update to NPM 8+?

@ekohl ekohl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a real review, but I'd prefer to wrap up https://community.theforeman.org/t/drop-debian-11-ruby-2-7-and-nodejs-14-support-in-foreman-3-14/40503 first. Once we drop NodeJS 14 we should get NPM 8 or higher out of the box on all our supported platforms and that simplifies this PR.

Edit: for completeness, the NPM versions in packaging:

  • EL9 with NodeJS 18: 10.2.4 (dnf module enable nodejs:18 && dnf install npm)
  • Debian 12 with NodeJS 17: 9.2.0 (https://packages.debian.org/bookworm/npm)
  • Ubuntu 22.04: TODO (OS repo has NodeJS 12 so we use nodesource; 14 at the moment)

@ekohl

ekohl commented Dec 19, 2024

Copy link
Copy Markdown
Member

@theforeman/packaging are we ok to update to NPM 8+?

When we merge #10406 it should be something we get for free.

Comment thread app/assets/javascripts/application.js Outdated

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to a react page anyway

Comment thread webpack/assets/javascripts/bundle.js Outdated
Comment on lines 61 to 64

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move to window directly, not under tfm

@MariaAga

MariaAga commented Mar 10, 2025

Copy link
Copy Markdown
Member Author

dnd still not working in host edit with vm ware - need to fix
edit: https://projects.theforeman.org/issues/37882

@MariaAga
MariaAga force-pushed the remove-foreman-vendor branch from 005f580 to 6fbd51d Compare April 2, 2025 12:09
Comment thread package.json Outdated
@MariaAga
MariaAga force-pushed the remove-foreman-vendor branch from 6fbd51d to 51e67a1 Compare April 4, 2025 10:42
Comment thread config/webpack.vendor.js Outdated
Comment on lines 119 to 99

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread config/webpack.vendor.js Outdated
@MariaAga
MariaAga force-pushed the remove-foreman-vendor branch from 51e67a1 to b6a647e Compare April 4, 2025 15:31
Comment thread webpack/assets/javascripts/exportAll.js Outdated
Comment thread package.json Outdated
@MariaAga
MariaAga force-pushed the remove-foreman-vendor branch from b6a647e to 785ab7e Compare April 10, 2025 13:52
@MariaAga MariaAga added the Breaking change This PR may break plugins - maintainers try to apply it as best effort label Apr 15, 2025
Comment thread webpack/assets/javascripts/react_app/common/scss/vendor-core.scss Outdated
@ShimShtein

ShimShtein commented Jul 8, 2025

Copy link
Copy Markdown
Member

Comment thread config/webpack.config.js Outdated
@ShimShtein

Copy link
Copy Markdown
Member

@MariaAga

MariaAga commented Jul 9, 2025

Copy link
Copy Markdown
Member Author

@ShimShtein it is unrelated (org tests just randomly fail)

@evgeni

evgeni commented Jul 10, 2025

Copy link
Copy Markdown
Member

/packit build

Comment thread package.json Outdated
@evgeni

evgeni commented Jul 10, 2025

Copy link
Copy Markdown
Member
ModuleNotFoundError: Module not found: Error: Can't resolve 'react-bootstrap' in '/usr/lib/node_modules/react-ellipsis-with-tooltip/dist'

Mhh, react-bootstrap is a peerDependency of react-ellipsis-with-tooltip, and our packaging doesn't pull those in.

@MariaAga
MariaAga force-pushed the remove-foreman-vendor branch from 01cee4f to 8c47a76 Compare July 10, 2025 09:29
@MariaAga

Copy link
Copy Markdown
Member Author

@evgeni

Mhh, react-bootstrap is a peerDependency of react-ellipsis-with-tooltip, and our packaging doesn't pull those in.

is this a hint for me to add it?

@evgeni

evgeni commented Jul 10, 2025

Copy link
Copy Markdown
Member

not yet :)

Comment thread package.json Outdated
"datatables.net-bs": "1.13.5",
"datatables.net-dt": "1.13.5",
"datatables.net": "1.13.5",
"diff": "^4.0.1",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

theforeman/foreman-packaging#12212 bumped the packaged diff to 5.2.0, can we do the same here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll go check if we can use v5

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MariaAga , I have matched the diff version to unidiff 1.0.4

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually cant find where we even use diff?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the last use was here? 0b167ac#diff-9bfb62f05186261a2516e33d3b97b39947316f570fde17c8cd91f32f99d51835
So I guess I can just update now and delete later

@evgeni

evgeni commented Jul 10, 2025

Copy link
Copy Markdown
Member

#10601 - let's see if adding react-bootstrap helps.

Edit:

[webpack-cli] ModuleNotFoundError: Module not found: Error: Can't resolve 'react-router' in '/usr/lib/node_modules/connected-react-router/esm'

Well, at least it's a different error now? 😿

@evgeni

evgeni commented Jul 10, 2025

Copy link
Copy Markdown
Member

@MariaAga okay, now that #10601 has built on packit: please pull in the react-router and react-bootstrap changes I did into package.json.

I have no idea if it also needs to be added to webpack.js -- seems to work without as long as the peer dependency is satisfied.

Packaging update:

and seperate javascript and react app imports
@MariaAga
MariaAga force-pushed the remove-foreman-vendor branch from 92da380 to 4012727 Compare July 10, 2025 13:49
@MariaAga

Copy link
Copy Markdown
Member Author

no runtime error for not adding react-router and react-bootstrap to webpack vendor list

@evgeni

evgeni commented Jul 10, 2025

Copy link
Copy Markdown
Member

/packit build

@evgeni

evgeni commented Jul 10, 2025

Copy link
Copy Markdown
Member

green packit! 🍏

@evgeni

evgeni commented Jul 11, 2025

Copy link
Copy Markdown
Member

Ubuntu 22.04: TODO (OS repo has NodeJS 12 so we use nodesource; 14 at the moment)

NodeJS 18.20.6 with NPM 10.8.2

@evgeni evgeni left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📦 wise this is fine and I have no concerns, especially as Packit is green

@ShimShtein ShimShtein left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I won't block on these

Comment thread config/webpack.config.js
Comment on lines +100 to +101
__dirname,
'..',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
__dirname,
'..',
root,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then in the next pr (scalprum)

Comment thread config/webpack.config.js
Comment on lines +105 to +106
__dirname,
'..',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
__dirname,
'..',
root

@ShimShtein
ShimShtein merged commit 8afe2c4 into theforeman:develop Jul 14, 2025
59 of 65 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking change This PR may break plugins - maintainers try to apply it as best effort Docs Legacy JS PRs making changes in the legacy Javascript stack UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants